'\" t
.TH "SYSTEMD\&.TARGET" "5" "" "systemd 257" "systemd.target"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
systemd.target \- Target unit configuration
.SH "SYNOPSIS"
.PP
\fItarget\fR\&.target
.SH "DESCRIPTION"
.PP
A unit configuration file whose name ends in
"\&.target"
encodes information about a target unit of systemd\&. Target units are used to group units and to set synchronization points for ordering dependencies with other unit files\&.
.PP
This unit type has no specific options\&. See
\fBsystemd.unit\fR(5)
for the common options of all unit configuration files\&. The common configuration items are configured in the generic [Unit] and [Install] sections\&. A separate [Target] section does not exist, since no target\-specific options may be configured\&.
.PP
Target units do not offer any additional functionality on top of the generic functionality provided by units\&. They merely group units, allowing a single target name to be used in
\fIWants=\fR
and
\fIRequires=\fR
settings to establish a dependency on a set of units defined by the target, and in
\fIBefore=\fR
and
\fIAfter=\fR
settings to establish ordering\&. Targets establish standardized names for synchronization points during boot and shutdown\&. Importantly, see
\fBsystemd.special\fR(7)
for examples and descriptions of standard systemd targets\&.
.PP
Target units provide a more flexible replacement for SysV runlevels in the classic SysV init system\&. For compatibility reasons special target units such as
runlevel3\&.target
exist which are used by the SysV runlevel compatibility code in systemd, see
\fBsystemd.special\fR(7)
for details\&.
.PP
Note that a target unit file must not be empty, lest it be considered a masked unit\&. It is recommended to provide a [Unit] section which includes informative
\fIDescription=\fR
and
\fIDocumentation=\fR
options\&.
.SH "AUTOMATIC DEPENDENCIES"
.SS "Implicit Dependencies"
.PP
There are no implicit dependencies for target units\&.
.SS "Default Dependencies"
.PP
The following dependencies are added unless
\fIDefaultDependencies=no\fR
is set:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Target units will automatically complement all configured dependencies of type
\fIWants=\fR
or
\fIRequires=\fR
with dependencies of type
\fIAfter=\fR
unless
\fIDefaultDependencies=no\fR
is set in the specified units\&.
.sp
Note that the reverse is not true\&. For example, defining
\fBWants=that\&.target\fR
in
some\&.service
will not automatically add the
\fBAfter=that\&.target\fR
ordering dependency for
some\&.service\&. Instead,
some\&.service
should use the primary synchronization function of target type units, by setting a specific
\fBAfter=that\&.target\fR
or
\fBBefore=that\&.target\fR
ordering dependency in its \&.service unit file\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Target units automatically gain
\fIConflicts=\fR
and
\fIBefore=\fR
dependencies against
shutdown\&.target\&.
.RE
.SH "OPTIONS"
.PP
Target unit files may include [Unit] and [Install] sections, which are described in
\fBsystemd.unit\fR(5)\&. No options specific to this file type are supported\&.
.SH "EXAMPLE"
.PP
\fBExample\ \&1.\ \&Simple standalone target\fR
.sp
.if n \{\
.RS 4
.\}
.nf
# emergency\-net\&.target

[Unit]
Description=Emergency Mode with Networking
Requires=emergency\&.target systemd\-networkd\&.service
After=emergency\&.target systemd\-networkd\&.service
AllowIsolate=yes
.fi
.if n \{\
.RE
.\}
.PP
When adding dependencies to other units, it\*(Aqs important to check if they set
\fIDefaultDependencies=\fR\&. Service units, unless they set
\fIDefaultDependencies=no\fR, automatically get a dependency on
sysinit\&.target\&. In this case, both
emergency\&.target
and
systemd\-networkd\&.service
have
\fIDefaultDependencies=no\fR, so they are suitable for use in this target, and do not pull in
sysinit\&.target\&.
.PP
You can now switch into this emergency mode by running
\fIsystemctl isolate emergency\-net\&.target\fR
or by passing the option
\fIsystemd\&.unit=emergency\-net\&.target\fR
on the kernel command line\&.
.PP
Other units can have
\fIWantedBy=emergency\-net\&.target\fR
in the
\fI[Install]\fR
section\&. After they are enabled using
\fBsystemctl enable\fR, they will be started before
\fIemergency\-net\&.target\fR
is started\&. It is also possible to add arbitrary units as dependencies of
emergency\&.target
without modifying them by using
\fBsystemctl add\-wants\fR\&.
.SH "SEE ALSO"
.PP
\fBsystemd\fR(1), \fBsystemctl\fR(1), \fBsystemd.unit\fR(5), \fBsystemd.special\fR(7), \fBsystemd.directives\fR(7)
